#ifndef FILETABLE_H
#define FILETABLE_H

#include <QWidget>
#include <QSortFilterProxyModel>
#include <QTreeView>
#include <QAbstractItemModel>
#include <QStandardItemModel>
#include <QGroupBox>
#include <QDockWidget>
#include <QPushButton>
#include "fileoperations.h"
#include <QDialog>
#include <QToolButton>
#include <QMenu>


class FileTable : public QDialog
{
    Q_OBJECT

public:
    FileTable( QWidget *parent = 0 );
    ~FileTable();

public:
	static void initModel();
    static QStandardItemModel *itemModel;
    static QList<SLEPItem> *slepItemList;
	static QString *currentDir;
	static QString *outputDir;


    int getSelection();
    int getSelectionType(int selection);
    void getDenseMatrix(int selection, int *m, int *n, double **data);
    void getDenseVector(int selection, int *dimension, double **data);
    void getSparseVector(int selection, int *nnz, double **data, int **index);
    void getSingleValue(int selection, double *value);
	void getGroupIndices(int selection, int *size,int **indices);
    QStandardItemModel* getItemModel();
    QList<SLEPItem>* getSlepItemList();

public slots:
    void actAddMatrix();
    void actAddVector();
	void actAddGroupIndices();
    void actAddRandomData();
	void actAddSomething();
    void actRemove();
    void actViewData();

	void actChangeCurrentDir();
	void actChangeOutputDir();

	void onSelectionChange(const QItemSelection &,const QItemSelection &);

signals:
	void signalSelectionChanged(void*);

private:
    int whatItemIsFile(QString filename);
    void readItemFromFile(QString filename, SLEPItem *item);

private:

	QAction *actionAddMatrix;
	QAction *actionAddVector;
	QAction *actionAddRandomData;
	QAction *actionAddGroupIndices;
	QAction *actionViewData;
	QAction *actionViewHistogram;
	QAction *actionRemove;
	QAction *actionAnyData;

	QAction *actionChangeCurrentDir;
	QAction *actionChangeOutputDir;

	QMenu *menuAdd;
	QMenu *menuView;
	QMenu *menuMore;
	QToolButton *toolButtonAdd;
	QToolButton *toolButtonView;
	QToolButton *toolButtonMore;

    QTreeView *treeView;
    QItemSelectionModel *selection;
};




#endif // FILETABLE_H
